const API_BASE_URL = 'https://mnp.zhusiot.com/';

/**
 * 封封微信的的request
 */
function requestByJson(url, data = {}) {
  return new Promise(function (resolve, reject) {
    wx.request({
      url: url,
      data: data,
      dataType: 'json',
      header: {
        'content-type': 'application/json' // 默认值
      },
      success: function (res) {
        if (res.statusCode == 200) {
          resolve(res.data);
        } else {
          reject(res.statusCode + '/' + res.errMsg);
        }
      },
      fail: function (err) {
        reject(err)
      }
    })
  });
}


module.exports = {
  requestByJson,
}